/*
 *@author: YangJie
 *@date: 2021-04-07 16:48:13
 *@version:
 *@description:维修保养=>故障报修
 */
import React, { Component } from 'react';
import { Table, Button, Form, Input,  TreeSelect, DatePicker, Select, Switch, Row, Col, Modal, InputNumber, Spin } from 'antd';
import '@/assets/css/settings';
import * as Utils from '../../../utils_yyr/action';
import { withRouter } from 'react-router-dom';
import Paging from '../../../components_yyr/commponent/Paging';
import { euqApplicationName, lotAuth, lotAuth2 } from '../../../config';
import moment from 'moment';
import 'moment/locale/zh-cn';
moment.locale('zh-cn')

const nowDate = Utils.getNowDate()
const { TreeNode } = TreeSelect
const { Option } = Select
const { TextArea } = Input
const FormItem = Form.Item;
function range(start, end) {
	const result = [];
	for (let i = start; i < end; i++) {
		result.push(i);
	}
	return result;
}
var chooseData;
var formValuesOld;
var valueOld;
class EquipmentTypeAnalyse6_recordDetails extends Component {
	state = {
		spinning: false,
		loading: false, //加载中...
		dataSource: [], //数据源
		dataSource1: [],
		drawerVisible: false, //新增修改抽屉的显示与隐藏
		chooseData: {},
		drawerTitle: '',
		total: 0,
		formValues: {},
		cityData: [],
		mainFactoryList: [],
		selectedData: [],
		selectedKeys: [],
		handleType: 0,
		EquTypePageList: [],
		gzdj: [],//故障等级列表,
		gzlb: [],//故障类型列表,
		DepartmentList: [],//部门列表
		UserList: [],//用户查询
		jjcd: [],//紧急程度列表
		wxz: [],
		visibleEqu: false,
		loadingTable: false,
		tableData: [],
		totalTable: 0,
		formValuesTable: {},
		selectedDataTable: [],
		status: 0,
		selectedKeysTable: [],
		value: 1,
		wxlb: [],
		wxjb: [],
		wxzt: [],
		gzyy: [],
		zydw: [],
		wldw: [],
		sbbw: [],
		visiblePeo: false,
		equipmentRepairWorkAddDTOList: [],
		switchChecked: false,
		selectedDataTable: [],
		selectedKeysTable: [],
		totalTablePeo: 0,
		formValuesTablePeo: {},
		peopleData: [],
		dateStartTime: '',
		dateEndTime: '',
		dateEndDisabeld: true, datePickerLoading: false, selectedDataTablePeoSelect: []
	};
	constructor(props) {
		super(props);
		console.log(props);
		chooseData = props.record
		formValuesOld = props.formValues
		valueOld = props.value
	}
	componentDidMount() {
		this.setState({ spinning: true })
		this.gzdj();
		this.gzlb();
		this.EquTypePageList()
		this.queryTreeDepartment()
		this.queryPageUser()
		this.jjcd()
		this.wxz()
		this.wxjb()
		this.wxlb()
		this.wxzt()
		this.gzyy()
		this.zydw()
		this.wldw()
		setTimeout(() => {
			this.fetch();
		}, 50);
	}
	//初始化加载数据
	fetch = () => {
		let id = chooseData.repairCode
		console.log(id)
		this.get(euqApplicationName + '/equipmentRepair/findPerformMaintenanceOrDetailed?code=' + id).then(res => {
			console.log(res)
			let data = res
			if (data['equTypeId']) {
				this.get(euqApplicationName + '/parameter_setting_equipmentType/findEquTypeRegionPageList/' + data.equTypeId).then(res => {
					this.setState({ sbbw: res.data })
				})
			}
			const arr = ['equRepairCode', 'equCode', 'equSpecsModel', 'equName', 'equType', 'deptName', 'equPosition', 'occurrenceTime', 'operator', 'equLocation', 'repairType', 'faultLevel', 'faultDescription', 'repairCause', 'repairTeamId', 'repairLevel', 'repairType', 'urgencyId', 'isStop', 'stopDuration', 'dateSec_repairStartTime', 'dateSec_repairEndTime', 'hours', 'miuntes', 'repairConsume', 'outsource', 'workDesc', 'faultCategory', 'orderCode', 'repairMan', 'time']
			let obj = {}
			if (data.repairStartTime) {
				this.setState({
					dateStartTime: data.repairStartTime
				})
			}
			if (data.repairEndTime) {
				this.setState({
					dateEndTime: data.repairEndTime
				})
			}
			if (data.status == 8) {
				obj['repairStatus'] = 158
			}
			for (var item of arr) {
				if (item.indexOf('dateSec_') === 0) {
					let arrs = item.split('_');
					if (data[arrs[1]]) {
						console.log(data[arrs[1]])
						obj[`${item}`] = moment(data[arrs[1]])
					}
					// data[arrs[1]] = moment(data[arrs[1]],"YYYY-MM-DD");
					// obj[`${item}`] = data[`${arrs[1]}`]
				}
				else if (item === 'isStop') {
					obj[`isStop`] = data[`isStop`] ? true : false
				} else if (item === 'hours') {
					obj[`hours`] = data[`repairTime`] ? data[`repairTime`].split('小时')[0] : 0
				} else if (item === 'miuntes') {
					obj[`miuntes`] = data[`repairTime`] ? data[`repairTime`].split('小时')[1].split('分')[0] : 0
				}
				else {
					if (data[`${item}`]) {
						obj[`${item}`] = data[`${item}`]
					}
				}
			}
			setTimeout(() => {
				this.props.form.setFieldsValue(obj)
				this.setState({ spinning: false })
			}, 50);
			this.setState({
				drawerTitle: data.status === 1 || data.status === 2 ? '修改' : '详情',
				drawerVisible: true,
				chooseData: data,
				status: data.status,
				equipmentRepairWorkAddDTOList: Object.keys(data).length >= 1 && data.equipmentRepairWorkAddDTOList ? data.equipmentRepairWorkAddDTOList : []
			});
		})


	};
	zydw = () => {//租用单位列表
		this.get(euqApplicationName + '/parameter_setting_public/queryRentDepartmentList?type=2').then(res => {
			this.setState({
				zydw: res.data,
			});
		})
	}

	wldw = () => {//往来单位列表
		this.get(euqApplicationName + '/parameter_setting_public/queryRentDepartmentList?type=1').then(res => {
			this.setState({
				wldw: res.data,
			});
		})
	}
	//   用户查询
	queryPageUser = () => {
		this.get(lotAuth2 + '/user/queryPageUser').then(res => {
			console.log(res.data.data)
			this.setState({
				UserList: res.data.data
			});
		})
	}
	// 部门查询

	queryTreeDepartment = () => {
		// this.get(lotAuth + '/department/queryTreeDepartment').then(res => {
			this.get(lotAuth2 + '/department/queryTreeDepartment').then(res => {
			console.log(res.data)
			this.setState({
				DepartmentList: res.data
			});
		})
	}

	EquTypePageList = () => {
		this.get(euqApplicationName + '/parameter_setting_equipmentType/findEquTypePageList').then(res1 => {
			console.log(res1.data)
			this.setState({
				EquTypePageList: res1.data
			});
		})
	}
	wxz = () => {//维修组
		this.get(euqApplicationName + '/parameter_setting_public/queryTeamPageList?type=维修').then(res => {
			this.setState({
				wxz: res.data,
			});
		})
	};
	gzdj = () => {//故障等级列表
		this.get(euqApplicationName + '/api/findEquipmentNextParameterPageList?typeId=3').then(res => {
			this.setState({
				gzdj: res.data,
			});
		})
	};
	jjcd = () => {//紧急程度列表
		this.get(euqApplicationName + '/api/findEquipmentNextParameterPageList?typeId=8').then(res => {
			this.setState({
				jjcd: res.data,
			});
		})
	};
	gzyy = () => {//故障原因列表
		this.get(euqApplicationName + '/api/findEquipmentNextParameterPageList?typeId=4').then(res => {
			this.setState({
				gzyy: res.data,
			});
		})
	};
	wxjb = () => {//维修级别列表
		this.get(euqApplicationName + '/api/findEquipmentNextParameterPageList?typeId=5').then(res => {
			this.setState({
				wxjb: res.data,
			});
		})
	};
	wxlb = () => {//维修类别列表
		this.get(euqApplicationName + '/api/findEquipmentNextParameterPageList?typeId=7').then(res => {
			this.setState({
				wxlb: res.data,
			});
		})
	};
	wxzt = () => {//维修状态列表
		this.get(euqApplicationName + '/api/findEquipmentNextParameterPageList?typeId=11').then(res => {
			this.setState({
				wxzt: [{ configValue: '已完成', id: 158 }],
			});
		})
	};
	gzlb = () => {//故障类型列表
		this.get(euqApplicationName + '/api/findEquFaultTypePageList').then(res => {
			this.setState({
				gzlb: res.data,
			});
		})
	};
	getInfo = () => {
		this.post('/carrierPrice/mainFactoryList').then(res => this.setState({ mainFactoryList: res.data })); //主机厂
	};

	//表单查询
	filterSubmit = values => {
		console.log("表单查询=====", values)

		values.pageNum = this.state.formValues.pageNum;
		values.pageSize = this.state.formValues.pageSize;
		this.fetch(values);
	};

	// 表格删除
	handleConfirm = (value, api, chooseData) => {
		console.log(this.state.selectedData)
		let str = ''
		for (var item of this.state.selectedData) {
			str += item.informationId + ','
		}
		this.get(`${euqApplicationName}/equipmentRepairFault/deleteEquipmentRepairFaultList?ids=${str.slice(0, str.length - 1)}`).then(res => {
			this.success();
			this.fetch({ ...this.state.formValues });
			this.setState({ selectedKeys: [], selectedData: [] })
		});
	};

	// 表格打印
	handlePrinting = (type, data) => {
		console.log("打印=====")
	}

	formList = () => {
		const formList = [
			{
				type: 'SELECT', label: '处理状态', field: 'status', name: 'value',
				// 处理状态1.待审核 2.审核中 3.待维修 4.维修中 5.待验证 6.已完成
				list: [{ id: 1, value: '待审核' }, { id: 2, value: '审核中' }, { id: 3, value: '待维修' }, { id: 4, value: '维修中' }, { id: 5, value: '待验证' }, { id: 6, value: '已完成' }],
				valueField: 'id'
			},
			{
				type: 'SELECT', label: '报修人', field: 'operator', name: 'value', name: 'userName', valueField: 'userId', list: this.state.UserList,
			},
			// {
			// 	type: 'SELECT', label: '相关性', field: 'route', name: 'value',
			// 	list: [{ id: 1, value: '我报修' }, { id: 2, value: '待我审核' }],
			// 	valueField: 'value'
			// }
		];
		return formList;
	};

	formListModal = () => {
		const { EquTypePageList, DepartmentList } = this.state;
		const formList = [
			{ type: 'TREESELECT', label: '设备类别', field: 'equType', name: 'name', valueField: 'id', list: EquTypePageList, allowClear: true },
			{ type: "TREESELECT", label: "所在部门", field: "deptId", name: 'name', valueField: 'id', list: DepartmentList },
		];
		return formList;
	};

	//表单查询
	filterSubmitModal = values => {
		console.log("表单查询=====", values)

		values.pageNum = this.state.formValues.pageNum;
		values.pageSize = this.state.formValues.pageSize;
		this.fetch(values);
	};

	drawerFormList = data => {
		const { mainFactoryList, EquTypePageList, gzdj, gzlb, DepartmentList, UserList, jjcd } = this.state;
		const drawerFormList = [
			{ type: 'TITLE', label: '设备信息' },
			{ type: "INPUT", label: "设备编号", field: "equCode", initialValue: data.equCode },
			{ type: "INPUT", label: "设备名称", field: "equName", initialValue: data.equName, required: true },
			{ type: 'TREESELECT', label: '设备类别', field: 'equType', initialValue: data.equType, name: 'name', valueField: 'id', list: EquTypePageList, allowClear: true },
			{ type: "INPUT", label: "规格型号", field: "equSpecsModel", initialValue: data.equSpecsModel },
			{ type: "TREESELECT", label: "所在部门", field: "deptId", initialValue: data.deptId, name: 'name', valueField: 'id', list: DepartmentList },
			{ type: "INPUT", label: "设备位置", field: "equPosition", initialValue: data.equPosition },
			{
				type: "BUTTON", label: "选择设备", modalType: 'TABLE', ModalProps: {

				}
			},

			{ type: 'TITLE', label: '处理情况' },
			{ type: "DATE", label: "发生时间", field: "dateSec_occurrenceTime", initialValue: data.occurrenceTime ? data.occurrenceTime : nowDate, required: true, showTime: true },
			{ type: "INPUT", label: "操作人", field: "operator", initialValue: data.operator },
			{ type: "INPUT", label: "操作者电话", field: "operatorTel", initialValue: data.operatorTel },
			{ type: "SELECT", label: "故障等级", field: "faultLevel", initialValue: data.faultLevel, name: 'configValue', valueField: 'id', list: gzdj },
			{ type: "TREESELECT", label: "故障类别", field: "faultTypeId", initialValue: data.faultTypeId, name: 'name', valueField: 'id', list: gzlb, allowClear: true },
			{ type: "SELECT", label: "维修组", field: "maintainTeamId", initialValue: data.maintainTeamId, name: 'value', valueField: 'id', list: mainFactoryList.wxGroup },
			{ type: "SELECT", label: "紧急程度", field: "urgency", initialValue: data.urgency, name: 'configValue', valueField: 'id', list: jjcd },
			{
				type: "RADIO", label: "是否停机", field: "isStop", initialValue: data.isStop,
				list: [{ id: 1, name: '停机' }, { id: 0, name: '不停机', checked: true }], name: 'name', valueField: 'id',
			},
			// { type: "INPUT", label: "经验代码", field: "uniqueAddress", initialValue: data.uniqueAddress, list: mainFactoryList },
			{ type: "SELECT", label: "下一审核人", field: "lastOperate", initialValue: data.lastOperate, name: 'userName', valueField: 'userId', list: UserList, required: true },
			{ type: "TEXTAREA", label: "故障描述", field: "faultDescription", initialValue: data.faultDescription, required: true },
			// { type: "BOTTOM", label: "经验库", field: "harborMinimumPrice", initialValue: data.harborMinimumPrice },

		];
		let obj = { type: "FILEUPLOAD", label: "图片上传", field: "upload_pictureId", apiPath: '/lot-file/file/uploadFile', buttonName: '上传图片', fileId: true }
		if (this.state.handleType === 0) {
			drawerFormList.push(obj)
		}
		return drawerFormList;
	};

	lastOperateIsChoose = () => {
		console.log(this.state.equipmentRepairWorkAddDTOList)
		const p = this
		this.handleSubmit()
	}

	// 提交modal
	handleSubmitApply = () => {
		const { dataSource, chooseData, selectedDataTable } = this.state;
		const p = this;
		const { form } = this.props;
		const apply = ['operateId', 'maintainTeamId', 'checkReview', 'repairWorker', 'planExeTime', 'dealReview', 'lastOperate']
		form.validateFieldsAndScroll(apply, (err, fieldsValue) => {
			if (err) {
				return;
			}
			console.log(fieldsValue)
			for (var key in fieldsValue) {
				//单个时间选择器--需要时分秒
				if (key === 'planExeTime') {
					if (fieldsValue[key]) {
						fieldsValue[key] = Utils.getDateHHMMYY_HHMMSS(fieldsValue[key]);
					}
				}
			}
			const id = this.state.chooseData && this.state.chooseData.id;
			fieldsValue.repairInfoId = id;
			fieldsValue.userId = localStorage.getItem('userId');
			fieldsValue.operateId = localStorage.getItem('userId');
			fieldsValue.informationId = chooseData.informationId
			console.log(fieldsValue)
			this.post(euqApplicationName + '/equipmentRepairFault/failureReportAudit', { data: fieldsValue }).then(res => {
				this.success();
				this.fetch({ ...this.state.formValues });
				this.onClose();
			});
		});

	};
	// 提交modal
	handleSubmit = () => {
		const { dataSource, chooseData, selectedDataTable } = this.state;
		let equipmentRepairWorkAddDTOList = this.state.equipmentRepairWorkAddDTOList
		const p = this;
		const { form } = this.props;
		form.validateFieldsAndScroll(['equRepairCode', 'equCode', 'equName', 'equType', 'deptId', 'equPosition', 'occurrenceTime', 'operator', 'equLocation', 'repairType', 'faultLevel', 'faultDescription', 'repairCause', 'repairTeamId', 'repairStatus', 'repairLevel', 'repairType', 'urgencyId', 'isStop', 'stopDuration', 'dateSec_repairStartTime', 'dateSec_repairEndTime', 'hours', 'miuntes', 'repairConsume', 'outsource', 'workDesc', 'faultCategory', 'orderCode', 'repairMan', 'time'], (err, fieldsValue) => {
			if (err) {
				return;
			}
			for (var key in fieldsValue) {
				//单个时间选择器--需要时分秒
				if (key.indexOf('dateSec_') === 0) {
					if (fieldsValue[key]) {
						let arr = key.split('_');
						fieldsValue[arr[1]] = Utils.getDateHHMMYY_HHMMSS(fieldsValue[key]);
					}
					delete fieldsValue[key];
				}
			}
			console.log(chooseData.occurrenceTime)
			console.log(fieldsValue.repairStartTime)
			console.log(fieldsValue.repairEndTime)
			if (fieldsValue.repairStartTime && chooseData.occurrenceTime) {
				let diffTime = this.diffTime(chooseData.occurrenceTime, fieldsValue.repairStartTime)
				console.log(this.diffTime(chooseData.occurrenceTime, fieldsValue.repairStartTime))
				if (!diffTime) {
					Utils.openNotification('warning', '开始时间需大于报修时间！')
					return
				}
			}
			if (fieldsValue.repairStartTime && fieldsValue.repairEndTime) {
				let diffTime = this.diffTime(fieldsValue.repairStartTime, fieldsValue.repairEndTime)
				if (!diffTime) {
					Utils.openNotification('warning', '开始时间不能大于结束时间！')
					return
				}
			}
			console.log(fieldsValue.repairStatus, '11')
			if (fieldsValue.repairStatus == 158) {
				if (!fieldsValue.repairEndTime) {
					Utils.openNotification('warning', '状态已完成,请选择维修结束时间！')
					return
				}
				if (equipmentRepairWorkAddDTOList.length == 0) {
					Utils.openNotification('warning', '状态已完成,请添加维修人员！')
					return
				}
				for (var lists of equipmentRepairWorkAddDTOList) {
					if (!lists.repairStartTime || !lists.repairEndTime) {
						Utils.openNotification('warning', '部分人员未填写维修工作时间！')
						return
					}
				}
				for (var iiiii of equipmentRepairWorkAddDTOList) {
					console.log(iiiii)
					if (iiiii.repairStartTime) {
						let str = this.diffTime(fieldsValue.repairStartTime, iiiii.repairStartTime)
						console.log(str)
						if (str[2] != 0 && str[2] < 0) {
							Utils.openNotification('warning', '个人维修时间不在总维修时间范围内！')
							return
						}
					}
					if (iiiii.repairEndTime) {
						let str = this.diffTime(iiiii.repairEndTime, fieldsValue.repairEndTime)
						console.log(str)
						if (str[2] != 0 && str[2] < 0) {
							Utils.openNotification('warning', '个人维修时间不在总维修时间范围内！')
							return
						}
					}
				}
			}
			if (equipmentRepairWorkAddDTOList.length == 0) {
				let o = {
					personId: localStorage.getItem('userId'),
					personName: localStorage.getItem('userName'),
					perType: 0
				}
				// let arr = []
				// arr.push(o)
				equipmentRepairWorkAddDTOList.push(o)
				// this.setState({equipmentRepairWorkAddDTOList:arr})
				console.log(equipmentRepairWorkAddDTOList)
			} else if (equipmentRepairWorkAddDTOList.length) {
				for (var key in equipmentRepairWorkAddDTOList) {
					if (key == 0) {
						equipmentRepairWorkAddDTOList[key].perType = 0
					} else {
						equipmentRepairWorkAddDTOList[key].perType = 1
					}
				}
			}
			fieldsValue.repairStatus = fieldsValue.repairStatus ? fieldsValue.repairStatus : null
			fieldsValue.isStop = fieldsValue.isStop ? 1 : 0
			fieldsValue.equId = selectedDataTable.length === 1 ? selectedDataTable[0].id : chooseData.equId
			fieldsValue.equInfoId = selectedDataTable.length === 1 ? selectedDataTable[0].id : chooseData.equInfoId
			const id = this.state.chooseData && this.state.chooseData.repairInfoId;
			fieldsValue.id = id;
			fieldsValue.faultInformationId = this.state.chooseData.faultInformationId
			fieldsValue.repairTreatmentId = this.state.chooseData.repairTreatmentId
			fieldsValue.treatment = this.state.chooseData.treatment
			fieldsValue.treatmentId = this.state.chooseData.treatmentId
			fieldsValue.userId = localStorage.getItem('userId');
			fieldsValue.equipmentRepairWorkAddDTOList = equipmentRepairWorkAddDTOList
			fieldsValue.repairTime = `${fieldsValue.hours ? fieldsValue.hours : 0}小时${fieldsValue.miuntes ? fieldsValue.miuntes : 0}分`
			console.log(fieldsValue)
			if (fieldsValue.repairStatus == 158 && fieldsValue.repairEndTime) {
				fieldsValue.id = this.state.chooseData.recordId ? this.state.chooseData.recordId : null
				fieldsValue.bShi = 0
				this.post(euqApplicationName + '/equipmentMaintenanceRecord/saveEquipmentMaintenanceRecord', { data: fieldsValue }).then(res => {
					this.success();
					this.props.history.push('/RepairWorkOrder')
					return
				});
				return
			}
			this.post(euqApplicationName + '/equipmentRepair/saveEquipmentRepair', { data: fieldsValue }).then(res => {
				this.success();
				this.props.history.push('/RepairWorkOrder')
			});
		});

	};

	// 打开modal，判断是修改还是新增 0新增 1修改
	handleModal = (type, data) => {
		if (type === 1) {
			const arr = ['faultDescription', 'isStop', 'urgency', 'maintainTeamId', 'faultTypeId', 'faultLevel', 'operatorTel', 'operator', 'dateSec_occurrenceTime', 'equCode', 'equName', 'equType', 'equSpecsModel', 'deptName', 'equPosition', 'lastOperate']
			let obj = {}
			for (var item of arr) {
				if (item === 'dateSec_occurrenceTime') {
					obj['dateSec_occurrenceTime'] = moment(data['occurrenceTime'])
				} else if (item === 'isStop') {
					obj[`isStop`] = data[`isStop`] ? true : false
				} else {
					obj[`${item}`] = data[`${item}`]
				}
			}
			setTimeout(() => {
				this.props.form.setFieldsValue(obj)
			}, 50);
			this.setState({
				drawerTitle: data.status === 1 || data.status === 2 ? '修改' : '详情',
				drawerVisible: true,
				chooseData: data,
				handleType: type,
				status: data.status
			});
		} else if (type === 0) {
			this.setState({
				drawerTitle: '新增',
				drawerVisible: true,
				chooseData: data,
				handleType: type,
				status: data.status
			});
		} else if (type === 2) {
			// 'operateId''maintainTeamId''checkReview','repairWorker','planExeTime','dealReview' -----审核
			const arr = ['faultDescription', 'isStop', 'urgency', 'maintainTeamId', 'faultTypeId', 'faultLevel', 'operatorTel', 'operator', 'dateSec_occurrenceTime', 'equCode', 'equName', 'equType', 'equSpecsModel', 'deptName', 'equPosition', 'lastOperate',]
			let obj = {
				'operateId': data['lastOperate'],
				'maintainTeamId': data['maintainTeamId'],
			}
			for (var item of arr) {
				if (item === 'dateSec_occurrenceTime') {
					obj['dateSec_occurrenceTime'] = moment(data['occurrenceTime'])
				} else if (item === 'isStop') {
					obj[`isStop`] = data[`isStop`] ? true : false
				} else {
					obj[`${item}`] = data[`${item}`]
				}
			}
			setTimeout(() => {
				this.props.form.setFieldsValue(obj)
			}, 50);
			this.setState({
				drawerTitle: '审核',
				drawerVisible: true,
				chooseData: data,
				handleType: type,
				status: data.status
			});
		}
	};

	onClose = () => {
		this.setState({
			drawerVisible: false,
			chooseData: {},
			status: 0
		});
		this.props.form.resetFields();
	};
	onTreeChange = () => { };

	renderTreeNodes = (data, name, valueField) =>
		// console.log(data, name, valueField)
		data && data.map(item => {
			if (item.children) {
				return (
					<TreeNode title={item[name]} key={item[valueField]} value={item[valueField]} dataRef={item}>
						{this.renderTreeNodes(item.children, name, valueField)}
					</TreeNode>
				);
			}
			return <TreeNode key={item[valueField]} value={item[valueField]} title={item[name]} {...item} />;
		});

	chooseEqu = () => {
		this.fetchTable({
			pageNum: 1,
			pageSize: 10
		})
		this.setState({ visibleEqu: true })
	}
	choosePeo = () => {
		this.fetchTablePeo({
			pageNum: 1,
			pageSize: 10
		})
		this.setState({ visiblePeo: true })
	}

	fetchTable = (data) => {
		let str = ''
		for (var key in data) {
			if (data[key]) {
				str += `&${key}=${data[key]}`
			}
		}
		this.setState({ loadingTable: true })
		this.get(euqApplicationName + '/equipmentInfo/findEquInfoList?' + str).then(res => {
			this.setState({
				loadingTable: false,
				tableData: res.data.data,
				totalTable: res.data.total,
				formValuesTable: data,
				selectedKeysTable: [],
				selectedDataTable: [],
			});
		})
	}
	fetchTablePeo = (data) => {
		let str = ''
		for (var key in data) {
			if (data[key]) {
				str += `&${key}=${data[key]}`
			}
		}
		this.setState({ loadingTable: true })
		this.get(euqApplicationName + '/equipmentMaintain/findUserOfMaintain?' + str).then(res => {
			this.setState({
				loadingTable: false,
				peopleData: res.data,
				totalTablePeo: res.total,
				formValuesTablePeo: data,
				selectedKeysTablePeo: [],
				selectedDataTablePeo: [],
				selectedDataTablePeoSelect: []
			});
		})
	}

	closeModal = () => {
		this.setState({ visibleEqu: false, visiblePeo: false })
	}

	modalSubmit = () => {
		if (this.state.selectedKeysTable.length !== 1) {
			Utils.openNotification('warning', '请（仅）选择一条数据！')
			return;
		}
		let data = this.state.selectedDataTable[0]
		// 'equCode', 'equName','equType','equSpecsModel','deptId','equPosition'
		this.props.form.setFieldsValue({
			equCode: data.equCode,
			equName: data.equName,
			equType: data.equTypeId,
			equSpecsModel: data.equSpecsModel,
			deptId: data.depId,
			equPosition: data.equipmentLocation,
		})
		this.closeModal()
	}

	modalSubmitPeo = () => {
		if (this.state.selectedKeysTablePeo.length === 0) {
			Utils.openNotification('warning', '请选择数据！')
			return;
		}
		let { equipmentRepairWorkAddDTOList } = this.state
		let data = this.state.selectedDataTablePeoSelect
		for (var item of data) {
			item.personId = item.id
			item.personName = item.userName
		}
		// 'repairStartTime' ,'repairEndTime' ,'wastedTime' ,'contentOrSteps',
		let newData = [...equipmentRepairWorkAddDTOList];
		console.log(newData)
		const ids = newData.map(item => item.personId);
		data.forEach(item => {
			ids.indexOf(item.personId) === -1 && newData.push({
				id: null,
				personId: item.id,
				personName: item.userName,
				// repairStartTime: nowDate,
				// repairEndTime: nowDate,
				wastedTime: '',
				contentOrSteps: '',
			});
		});
		console.log(newData)
		this.setState({
			equipmentRepairWorkAddDTOList: newData
		})
		this.closeModal()
	}
	TableSearch = () => {
		this.props.form.validateFields(['depId', 'equTypeId'], (err, values) => {
			if (!err) {
				console.log(values)
				values.pageNum = this.state.formValuesTable.pageNum;
				values.pageSize = this.state.formValuesTable.pageSize;
				this.fetchTable(values);
			}
		})
	}
	TableSearchPeo = () => {
		this.props.form.validateFields(['userName'], (err, values) => {
			if (!err) {
				console.log(values)
				values.pageNum = this.state.formValuesTable.pageNum;
				values.pageSize = this.state.formValuesTable.pageSize;
				this.fetchTablePeo(values);
			}
		})
	}

	onChangeRadio = e => {
		// console.log('radio checked', e.target.value);
		let value = e.target.value
		this.setState({
			value,
		});
	};
	datePickerStart = (date, dateString, record, index) => {
		let { equipmentRepairWorkAddDTOList } = this.state
		console.log(date, dateString, record, index)
		record.repairStartTime = Utils.getDateHHMMYY_HHMMSS(date)
		if (record.repairEndTime) {
			this.setState({ datePickerLoading: true })
			let str = this.diffTime(Utils.getDateHHMMYY_HHMMSS(date), record.repairEndTime)
			console.log(str)
			if (str[2] != 0 && str[2] < 0) {
				Utils.openNotification('warning', '开始时间不能大于结束时间！')
				record.wastedTime = 0
				this.setState({ datePickerLoading: false })
			} else {
				this.setState({ datePickerLoading: false })
				record.wastedTime = (str[0] * 24 + str[1]) * 60 + str[2]
			}
		}
	}
	datePickerEnd = (date, dateString, record, index) => {
		let { equipmentRepairWorkAddDTOList } = this.state
		console.log(date, dateString, record, index)
		record.repairEndTime = Utils.getDateHHMMYY_HHMMSS(date)
		if (record.repairStartTime) {
			this.setState({ datePickerLoading: true })
			let str = this.diffTime(record.repairStartTime, Utils.getDateHHMMYY_HHMMSS(date))
			console.log(str)
			if (str[2] != 0 && str[2] < 0) {
				Utils.openNotification('warning', '开始时间不能大于结束时间！')
				this.setState({ datePickerLoading: false })
				record.wastedTime = 0
			} else {
				record.wastedTime = (str[0] * 24 + str[1]) * 60 + str[2]
				this.setState({ datePickerLoading: false })
			}
		}
	}
	inputNumber = (e, record, index) => {
		let { equipmentRepairWorkAddDTOList } = this.state
		record.wastedTime = e.target.value
		console.log(e.target.value, record, index)
	}
	input1 = (e, record, index) => {
		let { equipmentRepairWorkAddDTOList } = this.state
		record.contentOrSteps = e.target.value
		console.log(e.target.value, record, index)
	}
	handleDelete = key => {
		const equipmentRepairWorkAddDTOList = [...this.state.equipmentRepairWorkAddDTOList];
		this.setState({ equipmentRepairWorkAddDTOList: equipmentRepairWorkAddDTOList.filter(item => item.personId !== key) });
	};
	SwitchOnChange = (checked) => {
		this.setState({ switchChecked: checked })
	}
	dateonChangeStart = (date, dateString) => {
		const { chooseData } = this.state;
		console.log(dateString)
		this.setState({ dateStartTime: dateString, dateEndDisabeld: false })
		if (chooseData.time) {
			let str = this.diffTime(chooseData.time, dateString)
			if (str[2] != 0 && str[2] < 0) {
				Utils.openNotification('warning', '开始时间需大于报修时间！')
				return
			}
		} else if (chooseData.occurrenceTime) {
			let str = this.diffTime(chooseData.occurrenceTime, dateString)
			if (str[2] != 0 && str[2] < 0) {
				Utils.openNotification('warning', '开始时间需大于发生时间！')
				return
			}
		}
		if (this.state.dateEndTime) {
			let str = this.diffTime(dateString, this.state.dateEndTime)
			console.log(str)
			if (str[2] != 0 && str[2] < 0) {
				Utils.openNotification('warning', '开始时间不能大于结束时间！')
				this.props.form.setFieldsValue({ 'hours': 0, 'dateSec_repairStartTime': '', 'miuntes': 0, })
			} else {
				this.props.form.setFieldsValue({ 'hours': str[0] * 24 + str[1] ? str[0] * 24 + str[1] : 0, 'miuntes': str[2] ? str[2] : 0 })
			}
			// if(str>0){
			// 	this.props.form.setFieldsValue({'hours':str*24})
			// }else{
			// 	Utils.openNotification('warning','开始时间不能大于结束时间！')
			// 	this.props.form.setFieldsValue({'hours':0,'dateSec_repairStartTime':moment('')})
			// }
		}
	}
	dateonChangeEnd = (date, dateString) => {
		console.log(dateString)
		this.setState({ dateEndTime: dateString })
		if (this.state.dateStartTime) {
			let str = this.diffTime(this.state.dateStartTime, dateString)
			console.log(str)
			if (str[2] != 0 && str[2] < 0) {
				Utils.openNotification('warning', '开始时间不能大于结束时间！')
				this.props.form.setFieldsValue({ 'hours': 0, 'dateSec_repairStartTime': '', 'miuntes': 0, })
			} else {
				this.props.form.setFieldsValue({ 'hours': str[0] * 24 + str[1] ? str[0] * 24 + str[1] : 0, 'miuntes': str[2] ? str[2] : 0 })
			}
			// if(str>0){
			// 	this.props.form.setFieldsValue({'hours':str*24})
			// }else{
			// 	Utils.openNotification('warning','开始时间不能大于结束时间！')
			// 	this.props.form.setFieldsValue({'hours':0,'dateSec_repairEndTime':moment('')})
			// }
		}
	}
	disabledDate = (current) => {
		const { dateStartTime, chooseData } = this.state;
		if (chooseData.time) {
			// 核心逻辑: 结束日期不能多余开始日期后60天，且不能早于开始日期
			return current < moment(chooseData.time) || current > moment().endOf('time');
		} else if (chooseData.occurrenceTime) {
			// 核心逻辑: 结束日期不能多余开始日期后60天，且不能早于开始日期
			return current < moment(chooseData.occurrenceTime) || current > moment().endOf('time');
		}
		else {
			return current > moment().endOf('time');
		}
	}
	handleEndDisabledDate = (current) => {
		const { dateStartTime, chooseData } = this.state;
		if (dateStartTime) {
			// 核心逻辑: 结束日期不能多余开始日期后60天，且不能早于开始日期
			return current < moment(dateStartTime) || current > moment().endOf('time');
		} else {
			return null;
		}

	}
	diffTime = (startDate, endDate) => {
		startDate = new Date(startDate);
		endDate = new Date(endDate);
		console.log(startDate.getTime())
		var diff = endDate.getTime() - startDate.getTime();//时间差的毫秒数 

		//计算出相差天数 
		var days = Math.floor(diff / (24 * 3600 * 1000));

		//计算出小时数 
		var leave1 = diff % (24 * 3600 * 1000);    //计算天数后剩余的毫秒数 
		var hours = Math.floor(leave1 / (3600 * 1000));
		//计算相差分钟数 
		var leave2 = leave1 % (3600 * 1000);        //计算小时数后剩余的毫秒数 
		var minutes = Math.floor(leave2 / (60 * 1000));

		//计算相差秒数 
		var leave3 = leave2 % (60 * 1000);      //计算分钟数后剩余的毫秒数 
		var seconds = Math.round(leave3 / 1000);

		return [days, hours, minutes];
	}
	render() {
		const columns = [
			{
				title: '删除', width: 80,
				render: (text, record) => {
					return <span><a href onClick={() => this.handleDelete(record.personId)} style={{ display: chooseData.status == 8 ? 'none' : 'block' }}>删除</a></span>
				}
			},
			{ title: '姓名', width: 150, dataIndex: 'personName' },
			{
				title: '维修开始时间', width: 150, dataIndex: 'repairStartTime', render: (text, record, index) => {
					return <DatePicker onChange={(date, dateString) => this.datePickerStart(date, dateString, record, index)} defaultValue={text ? moment(text) : ''} format="YYYY-MM-DD HH:mm" disabled={true} />
				}
			},
			{
				title: '维修完成时间', width: 150, dataIndex: 'repairEndTime', render: (text, record, index) => {
					return <span>
						<DatePicker onChange={(date, dateString) => this.datePickerEnd(date, dateString, record, index)} defaultValue={text ? moment(text) : ''} format="YYYY-MM-DD HH:mm" disabled={true} />
					</span>
					// return <span></span> 
					// <DatePicker onChange={(date,dateString,record,index)=>this.datePickerEnd(date,dateString,record,index)}/>
				}
			},
			{
				title: '维修用时（分钟）', width: 150, dataIndex: 'wastedTime',
				//  render:(text,record,index)=>{
				// 	return <InputNumber defaultValue={text ? text : ''} onBlur={(e)=>this.inputNumber(e,record,index)} onPressEnter={(e)=>this.inputNumber(e,record,index)}/>
				// }
			},
			//  { title: '实际维修工时', width: 200, dataIndex: 'wastedTime' },
			{
				title: '内容或步骤', width: 150, dataIndex: 'contentOrSteps', render: (text, record, index) => {
					return <Input defaultValue={text ? text : ''} disabled={true} onBlur={(e) => this.input1(e, record, index)} onPressEnter={(e) => this.input1(e, record, index)} />
				}
			},
		];

		const column = [
			{ title: '设备编码', width: 150, dataIndex: 'equCode' },
			{ title: '设备名称', width: 150, dataIndex: 'equName' },
			{ title: '规格型号', width: 150, dataIndex: 'equSpecsModel' },
			{ title: '使用部门', width: 150, dataIndex: 'userDepartment' },
			{ title: '设备类别', width: 150, dataIndex: 'equTypeName' },
			{ title: '设备位置', width: 150, dataIndex: 'equipmentLocation' },
		]
		const columnPeo = [
			{ title: '名称', width: 150, dataIndex: 'userName' },
			{ title: '职务', width: 150, dataIndex: 'roleName' },
			{ title: '使用部门', width: 150, dataIndex: 'department' },
			{ title: '执行班组', width: 150, dataIndex: 'teamName' },
		]
		const { chooseData, drawerVisible, drawerTitle, dataSource, dataSource1, loading, total, formValues, selectedData, selectedKeys, visibleEqu, totalTable, formValuesTable, loadingTable, selectedKeysTable, visiblePeo, equipmentRepairWorkAddDTOList, selectedKeysTablePeo, selectedDataTablePeo, formValuesTablePeo, totalTablePeo, peopleData } = this.state;
		const { mainFactoryList, EquTypePageList, gzdj, gzlb, DepartmentList, UserList, jjcd, wxz, wxjb, wxlb, wxzt, gzyy, zydw, wldw, sbbw } = this.state;

		const drawerProps = {
			// onRef: ref => (this.modalRef = ref),
			visible: drawerVisible,
			width: 1000,
			// drawerFormList: this.drawerFormList(chooseData),
			submit: this.lastOperateIsChoose,
			onClose: this.onClose,
			title: drawerTitle,
		};

		//选择框
		const rowSelectionTablePeo = {
			selectedRowKeys: selectedKeysTablePeo,
			onChange: (selectedRowKeys, selectedRows) => {
				this.setState({
					selectedDataTablePeo: selectedRows,
					selectedKeysTablePeo: selectedRowKeys
				})
			},
			onSelect: (record, selected, selectedRows, nativeEvent) => {
				let arr = this.state.selectedDataTablePeoSelect
				if (selected) {
					arr.push(record)
				} else {
					arr.forEach((item, index) => {
						console.log(item)
						if (item.id == record.id) {
							arr.splice(index, 1)
						}
					});
				}
				console.log(arr)
				this.setState({ selectedDataTablePeoSelect: arr })
			},
			onSelectAll: (selected, selectedRows, changeRows) => {
				console.log(selectedRows)
				this.setState({ selectedDataTablePeoSelect: selectedRows })
			}
		};

		const rowSelectionTable = {
			selectedRowKeys: selectedKeysTable,
			onChange: (selectedRowKeys, selectedRows) => {
				this.setState({
					selectedDataTable: selectedRows,
					selectedKeysTable: selectedRowKeys
				})
			},
		}
		const { getFieldDecorator } = this.props.form
		const p = this
		const modalProps = {
			title: "选择设备",
			visible: visibleEqu,
			width: '780px',
			onCancel() {
				p.closeModal();
			},
			okText: '保存',
			cancelText: '取消',
			onOk() {
				p.modalSubmit();
			}
		};

		const modalPropsPeople = {
			title: "选择人员",
			visible: visiblePeo,
			width: '780px',
			onCancel() {
				p.closeModal();
			},
			okText: '保存',
			cancelText: '取消',
			onOk() {
				p.modalSubmitPeo();
			}
		};
		const wwdw = zydw.concat(wldw)
		return (
			<div className="shadow-radius">
				<Spin spinning={this.state.spinning}>
					<Modal {...modalPropsPeople}>
						<Form  {... { labelCol: { xs: { span: 30 }, sm: { span: 6 }, }, wrapperCol: { xs: { span: 24 }, sm: { span: 14 } } }}>
							<Row gutter={24}>
								<Col span={10}>
									<Form.Item label="姓名">
										{getFieldDecorator('userName')(
											<Input placeholder='请输入姓名' allowClear />)}
									</Form.Item>
								</Col>
								{/* <Col span={10}>
								<Form.Item label="所在部门">
									{getFieldDecorator('department',)(
										<Select allowClear placeholder='请输入所在部门'>
												{DepartmentList.map(item=><Option value={item.id}>{item.name}</Option>)}
										</Select>)}
								</Form.Item>
						</Col> */}
								<Col span={4}>
									<Button type="primary" onClick={() => { this.TableSearchPeo() }}>查询</Button>
								</Col>
							</Row>
						</Form>
						<Table columns={columnPeo} dataSource={peopleData} pagination={false} loading={loadingTable} rowSelection={rowSelectionTablePeo} rowKey={(record, index) => record.id} />
						<Paging total={totalTablePeo} formValues={formValuesTablePeo} fetch={pager => this.fetchTablePeo(pager)} />
					</Modal>
					<Modal {...modalProps}>
						<Form  {... { labelCol: { xs: { span: 30 }, sm: { span: 6 }, }, wrapperCol: { xs: { span: 24 }, sm: { span: 14 } } }}>
							<Row gutter={24}>
								<Col span={10}>
									<Form.Item label="设备类别">
										{getFieldDecorator('equTypeId')(
											<TreeSelect onChange={this.onTreeChange} placeholder={'请选择设备类别'} showCheckedStrategy="SHOW_PARENT" treeCheckable={false} allowClear>
												{this.renderTreeNodes(EquTypePageList, 'name', 'id')}
											</TreeSelect>)}
									</Form.Item>
								</Col>
								{/* <Col span={10}>
								<Form.Item label="所在部门">
									{getFieldDecorator('depId',)(
										<Select allowClear placeholder='请输入所在部门'>
												{DepartmentList.map(item=><Option value={item.id}>{item.name}</Option>)}
										</Select>)}
								</Form.Item>
						</Col> */}
								<Col span={4}>
									<Button type="primary" onClick={() => { this.TableSearch() }}>查询</Button>
								</Col>
							</Row>
						</Form>
						<Table columns={column} dataSource={p.state.tableData} pagination={false} loading={loadingTable} rowSelection={rowSelectionTable} rowKey={(record, index) => record.id} childrenColumnName={''} />
						<Paging total={totalTable} formValues={formValuesTable} fetch={pager => this.fetchTable(pager)} />
					</Modal>
					{/* <BasicDrawers {...drawerProps} /> */}
					<div style={{ width: '100%' }}>
						<div >
							<Form {...{ labelCol: { xs: { span: 6 }, sm: { span: 8 }, }, wrapperCol: { xs: { span: 12 }, sm: { span: 16 }, } }}>
								<h2 style={{ fontSize: 16, color: '#0067B8', fontWeight: 600 }}>基本信息</h2>
								<Row gutter={24} style={{ width: 1200, margin: '0 auto' }}>
									<Col span={6}>

										<Form.Item label="维修单号">
											{getFieldDecorator('equRepairCode', {
												// rules: [{	required: true,	message: '请填写承运单号'}]
											})(<Input allowClear placeholder='不填可自动生成' disabled={true} />)}
										</Form.Item>
									</Col>
									<Col span={6}>
										<Form.Item label="设备编号">
											{getFieldDecorator('equCode', {
												// rules: [{	required: true,	message: '请填写承运单号'}]
											})(<Input allowClear placeholder='请输入设备编号' disabled={true} />)}
										</Form.Item>
									</Col>
									<Col span={6}>
										<Form.Item label="设备名称">
											{getFieldDecorator('equName', {
												rules: [{ required: true, message: '请输入设备名称' }]
											})(
												<Input allowClear placeholder='请输入设备名称' disabled={true} />)}
										</Form.Item>
									</Col>
									<Col span={6}>
										<Form.Item label="设备类别">
											{getFieldDecorator('equType')(
												// <TreeSelect onChange={this.onTreeChange} placeholder={'请选择设备类别'} showCheckedStrategy="SHOW_PARENT" treeCheckable={false}  allowClear>
												// {this.renderTreeNodes(EquTypePageList, 'name', 'id')}
												// </TreeSelect>)}
												<Input allowClear placeholder='请输入设备类别' disabled={true} />)}
										</Form.Item>
									</Col>
								</Row>
								<Row gutter={24} style={{ width: 1200, margin: '0 auto' }}>
									<Col span={6}>
										<Form.Item label="规格型号">
											{getFieldDecorator('equSpecsModel',)(
												<Input allowClear placeholder='请输入规格型号' disabled={true} />)}
										</Form.Item>
									</Col>
									<Col span={6}>
										<Form.Item label="所在部门">
											{getFieldDecorator('deptName',)(
												// <Select allowClear placeholder='请输入所在部门'>
												// 		{DepartmentList.map(item=><Option value={item.id}>{item.name}</Option>)}
												// </Select>)}
												<Input allowClear placeholder='请输入所在部门' disabled={true} />)}
										</Form.Item>
									</Col>
									<Col span={6}>
										<Form.Item label="设备位置">
											{getFieldDecorator('equLocation')(<Input allowClear placeholder='请输入设备位置' disabled={true} />)}
										</Form.Item>
									</Col>
									{/* <Col span={6}>
								<Button type="primary" onClick={()=>{this.chooseEqu()}} >选择设备</Button>
							</Col> */}
								</Row>
								<h2 style={{ fontSize: 16, color: '#0067B8', fontWeight: 600 }}>故障信息</h2>
								<Row gutter={24} style={{ width: 1200, margin: '0 auto' }}>
									<Col span={6}>
										<Form.Item label="报修单号">
											{getFieldDecorator('orderCode')(<Input allowClear placeholder='请输入报修单号' disabled={true} />)}
										</Form.Item>
									</Col>
									<Col span={6}>
										<Form.Item label="发生时间">
											{getFieldDecorator('occurrenceTime')(<Input allowClear placeholder='请输入发生时间' disabled={true} />)}
										</Form.Item>
									</Col>
									<Col span={6}>
										<Form.Item label="报修时间">
											{getFieldDecorator('time')(<Input allowClear placeholder='请输入报修时间' disabled={true} />)}
										</Form.Item>
									</Col>
									<Col span={6}>
										<Form.Item label="报修人" >
											{getFieldDecorator('repairMan',)(<Input allowClear placeholder='请输入报修人' disabled={true} />)}
										</Form.Item>
									</Col>
								</Row>
								<Row gutter={24} style={{ width: 1200, margin: '0 auto' }}>
									<Col span={6}>
										<Form.Item label="故障部位">
											{getFieldDecorator('equPosition')(<Select allowClear placeholder='请输入故障部位' disabled={true} >
												{sbbw.map(item => <Option value={`${item.id}`}>{item.name}</Option>)}
											</Select>)}
										</Form.Item>
									</Col>
									<Col span={6}>
										<Form.Item label="故障类别">
											{getFieldDecorator('faultCategory')(<TreeSelect onChange={this.onTreeChange} placeholder={'请选择故障类别'} showCheckedStrategy="SHOW_PARENT" treeCheckable={false} allowClear disabled={true} >
												{this.renderTreeNodes(gzlb, 'name', 'id')}
											</TreeSelect>)}
										</Form.Item>
									</Col>
									<Col span={6}>
										<Form.Item label="故障等级">
											{getFieldDecorator('faultLevel')(<Select allowClear placeholder='请输入故障等级' disabled={true} >
												{gzdj.map(item => <Option value={item.id}>{item.configValue}</Option>)}
											</Select>)}
										</Form.Item>
									</Col>
								</Row>
								<Row gutter={24} style={{ width: 1200, margin: '0 auto' }}>
									<Col span={6}>
										<Form.Item label="故障描述">
											{getFieldDecorator('faultDescription')(<TextArea allowClear placeholder='请输入故障描述' disabled={true} style={{ width: 460, height: 80 }} />)}
										</Form.Item>
									</Col>
									{/* <Col span={6}>
								<Form.Item label="故障语音">
									{getFieldDecorator('faultDescription')(<TextArea allowClear placeholder='请输入故障描述'/>)}
								</Form.Item>
							</Col> */}
								</Row>
								<h2 style={{ fontSize: 16, color: '#0067B8', fontWeight: 600 }}>处理情况</h2>
								<Row gutter={24} style={{ width: 1200, margin: '0 auto' }}>
									<Col span={6}>
										<Form.Item label="故障原因">
											{getFieldDecorator('repairCause')(<Select allowClear placeholder='请输入故障原因' disabled={true} >
												{gzyy.map(item => <Option value={item.id}>{item.configValue}</Option>)}
											</Select>)}
										</Form.Item>
									</Col>
									<Col span={6}>
										<Form.Item label="维修组">
											{getFieldDecorator('repairTeamId')(<Select allowClear placeholder='请输入维修组'  disabled={true}>
												{wxz.map(item => <Option value={item.id}>{item.name}</Option>)}
											</Select>)}
										</Form.Item>
									</Col>
									<Col span={6}>
										<Form.Item label="维修状态">
											{getFieldDecorator('repairStatus')(<Select allowClear placeholder='请输入维修状态'  disabled={true}>
												{wxzt.map(item => <Option value={item.id}>{item.configValue}</Option>)}
											</Select>)}
										</Form.Item>
									</Col>
									<Col span={6}>
										<Form.Item label="维修级别">
											{getFieldDecorator('repairLevel')(<Select allowClear placeholder='请输入维修级别' disabled={true} >
												{wxjb.map(item => <Option value={item.id}>{item.configValue}</Option>)}
											</Select>)}
										</Form.Item>
									</Col>
								</Row>
								<Row gutter={24} style={{ width: 1200, margin: '0 auto' }}>
									<Col span={6}>
										<Form.Item label="维修类别">
											{getFieldDecorator('repairType')(<Select allowClear placeholder='请输入维修类别' disabled={true} >
												{wxlb.map(item => <Option value={item.id}>{item.configValue}</Option>)}
											</Select>)}
										</Form.Item>
									</Col>
									<Col span={6}>
										<Form.Item label="紧急程度">
											{getFieldDecorator('urgencyId')(<Select allowClear placeholder='请输入紧急程度' disabled={true} >
												{jjcd.map(item => <Option value={item.id}>{item.configValue}</Option>)}
											</Select>)}
										</Form.Item>
									</Col>
									<Col span={6}>
										<Form.Item label="是否停机">
											{getFieldDecorator('isStop', { valuePropName: 'checked' })(<Switch onChange={this.SwitchOnChange} disabled={true} />)}
										</Form.Item>
									</Col>
									<Col span={6}>
										<Form.Item label="停机时长">
											{getFieldDecorator('stopDuration')(<Input allowClear placeholder="默认单位为分钟" disabled={true} />)}
										</Form.Item>
									</Col>
								</Row>
								<Row gutter={24} style={{ width: 1200, margin: '0 auto' }}>
									<Col span={6} >
										<Form.Item label="开始时间">
											{getFieldDecorator('dateSec_repairStartTime')(<DatePicker allowClear placeholder='请输入开始时间' onChange={this.dateonChangeStart}  disabled={true} format="YYYY-MM-DD HH:mm"
												disabledDate={this.disabledDate}
											// disabledTime={this.disabledDateTime}
											/>)}
										</Form.Item>
									</Col>
									<Col span={6} >
										<Form.Item label="结束时间">
											{getFieldDecorator('dateSec_repairEndTime')(<DatePicker allowClear placeholder='请输入结束时间' onChange={this.dateonChangeEnd} format="YYYY-MM-DD HH:mm"
												disabledDate={this.handleEndDisabledDate}
												// disabledTime={this.disabledDateTime} 
												disabled={true} />)}
										</Form.Item>
									</Col>
									<Col span={6}>
										<FormItem label="维修用时">
											<Form.Item style={{ display: 'inline-block', width: 'calc(50% - 12px)' }}>
												{getFieldDecorator('hours', { initialValue: 0 })(<InputNumber style={{ width: 60 }} disabled={true} />)}<span> 时 </span>
											</Form.Item>
											<Form.Item style={{ display: 'inline-block', width: 'calc(50% - 12px)' }}>
												{getFieldDecorator('miuntes', { initialValue: 0 })(<InputNumber style={{ width: 60 }} disabled={true} />)}<span> 分 </span>
											</Form.Item>
										</FormItem>
									</Col>

									<Col span={6}>
										<Form.Item label="维修费用">
											{getFieldDecorator('repairConsume')(<Input disabled={true} />)}
										</Form.Item>
									</Col>
								</Row>
								<Row gutter={24} style={{ width: 1200, margin: '0 auto' }}>
									<Col span={6}>
										<Form.Item label="外委单位">
											{/* wu */}
											{getFieldDecorator('outsource')(<Select allowClear placeholder='请输入外委单位' disabled={true} >
												{wwdw.map(item => <Option value={item.id}>{item.name}</Option>)}
											</Select>)}
										</Form.Item>
									</Col>
									<Col span={6}>
										<Form.Item label="工作描述">
											{getFieldDecorator('workDesc')(<TextArea allowClear placeholder='请输入工作描述' style={{ width: 460, height: 80 }} disabled={true} />)}
										</Form.Item>
									</Col>
								</Row>

							</Form>
							<h2 style={{ fontSize: 16, color: '#0067B8', fontWeight: 600 }}>维修工作量</h2>
							<div style={{ width: '100%' }}>
								<div style={{ width: 1200, margin: '0 auto' }}>
									{/* <Button icon="plus" type="primary" onClick={this.choosePeo} style={{display:chooseData.status==8 ? 'none' : 'block'}}>添加人员</Button> */}
									<Table columns={columns} rowKey={(record, index) => index} dataSource={equipmentRepairWorkAddDTOList} pagination={false} loading={this.state.datePickerLoading} scroll={{ y: 450, x: 1200 }} />
								</div>
							</div>
							{/* <h2 style={{fontSize:16,color:'#0067B8',fontWeight:600}}>更换备件</h2> */}
							{/* <Paging total={total} formValues={formValues} fetch={pager => this.fetch(pager)} /> */}
							{/* <Table columns={columns1} rowSelection={rowSelection} rowKey={(record, index) => index} dataSource={dataSource1} pagination={false} loading={loading} scroll={{ y: 250 }} /> */}
							{/* <Paging total={total} formValues={formValues} fetch={pager => this.fetch(pager)} /> */}
							<div style={{ width: '100%', marginTop: 100 }}>
								<div style={{ margin: '0 auto', width: '400px' }}>
									{/* <Button icon="check" onClick={this.lastOperateIsChoose} type="primary" style={{marginRight: 38,}}>保存</Button> */}
									{/* <Button onClick={() => { this.props.history.push('/RepairWorkOrder') }} icon="close">返回</Button> */}
								</div>
							</div>
						</div>
					</div>
				</Spin>
			</div>
		);
	}
}
export default Form.create()(withRouter(EquipmentTypeAnalyse6_recordDetails));
